<template>
<div class="">
    <div class="pr10">
        <div class="analyItem">
            <p class="analyItemTit tx-center">状态</p>
            <div class="analyItemCon">

            </div>
        </div>
    </div>
    <div class="thinScroll pr10" v-scrollHeight="84">
            <router-link tag="div" exact :to="{path:routerPath('threeZiLevel'),query:{pressIndex: 7, stageInfo: this.stageInfo, userInfo: userInfo}}" class=" analyItem anItemBor" active-class="anItemBor-active">
                <!-- <p class="analyItemTit tx-center analyLightGreen" v-if="Number(this.leftInfo.stId) === 1">咨询</p> -->
                <p class="analyItemTit tx-center " :class="Number(this.leftInfo.stId) === 1 ? 'analyLightGreen' : 'analyShallowGreen'">咨询</p>
                <!-- <p :class="['analyItemTit', 'tx-center', item.leLevel<nextLevel ? 'analyShallowGreen' : '']" v-else></p> -->
                <div class="analyItemCon">
                            <p class="col-md-4"><span class="cLightGray pr8">姓名</span><span class="cLightGray pr8">{{userInfo.u_name ? userInfo.u_name : ''}}</span></p >
                            <p class="col-md-4"><span class="cLightGray pr8">电话</span><span class="cLightGray pr8">{{userInfo.phone ? userInfo.phone : ''}}</span></p >
                            <p class="col-md-4"><span class="cLightGray pr8">微信</span><span class="cLightGray pr8">{{userInfo.weixin ? userInfo.weixin : ''}}</span></p >
                            <p class="col-md-4"><span class="cLightGray pr8">性别</span><span class="cLightGray pr8">{{userInfo.sex ? userInfo.sex : ''}}</span></p >
                </div>
            </router-link>
            <router-link tag="div" exact :to="{path:routerPath('threeRenLevel'),query:{pressIndex: 7, stageInfo: this.stageInfo}}" class=" analyItem anItemBor" active-class="anItemBor-active">
                <p class="analyItemTit tx-center analyLightGreen" v-if="Number(this.leftInfo.stId) === 2">认知</p>
                <p class="analyItemTit tx-center " v-else :class="Number(this.leftInfo.stId) > 2 ? 'analyShallowGreen' : ''">认知</p>
                <div class="analyItemCon">
                        <p class="col-md-4"><span class="cLightGray pr8">年龄</span><span class="cLightGray pr8">{{stageInfo.age}}</span></p >
                        <p class="col-md-4"><span class="cLightGray pr8">婚否</span><span class="cLightGray pr8">{{stageInfo.is_marry==0?'是':'否'}}</span></p >
                </div>
            </router-link>
            <router-link tag="div" exact :to="{path:routerPath('threeKaoLevel'),query:{pressIndex: 7, stageInfo: this.stageInfo}}" class=" analyItem anItemBor" active-class="anItemBor-active">
                <p class="analyItemTit tx-center analyLightGreen" v-if="Number(this.leftInfo.stId) === 3">考察</p>
                <p class="analyItemTit tx-center " v-else :class="Number(this.leftInfo.stId) > 3 ? 'analyShallowGreen' : ''">考察</p>
                <div class="analyItemCon">
                            <!-- <p class="col-md-4">
                                <span class="cLightGray pr8">面积</span>
                                <span >{{stageInfo.make_acreage_start ? stageInfo.make_acreage_start : 0}}-{{stageInfo.make_acreage_end ? stageInfo.make_acreage_end : 0}}</span>
                            </p>
                            <p class="col-md-4">
                                <span class="cLightGray pr8">类型</span>
                                <span >{{stageInfo.make_type}}</span>
                            </p> -->
                    <p>
                        <span class="cLightGray pr8 col-md-1">性格</span>
                        <span v-for="item in this.characterList" :key="item" class="col-md-1">{{item}}</span>
                    </p>
                </div>
            </router-link>
            <router-link tag="div" exact :to="{path:routerPath('threeQianLevel'),query:{pressIndex: 7, stageInfo: this.stageInfo}}" class=" analyItem anItemBor" active-class="anItemBor-active">
                <p class="analyItemTit tx-center analyLightGreen" v-if="Number(this.leftInfo.stId) === 4">签约</p>
                <p class="analyItemTit tx-center " v-else :class="Number(this.leftInfo.stId) > 4 ? 'analyShallowGreen' : ''">签约</p>
                <!-- <div class="analyItemCon"> -->
                    <div class="analyItemCon" v-if="this.Manager.user_join_state === 1">
                    <p class="col-md-6">
                        <span class="cLightGray pr8">保证金</span>
                        <span>10000</span>
                    </p>
                    <p class="col-md-6">
                        <span class="cLightGray pr8">实缴</span>
                        <span>{{platformMoney ? platformMoney : 0}}</span>
                    </p>
                    </div>
                    <div class="analyItemCon" v-else-if="this.Manager.user_join_state === 2">
                        <p class="col-md-6">
                            <span class="cLightGray pr8">保证金</span>
                            <span>10000</span>
                        </p>
                        <p class="col-md-6">
                            <span class="cLightGray pr8">实缴</span>
                            <span class="cRed">{{yajin ? yajin : 0}}</span>
                        </p>
                        <p class="col-md-6">
                            <span class="cLightGray pr8">平台费</span>
                            <span>5000</span>
                        </p>
                        <p class="col-md-6">
                            <span class="cLightGray pr8 cRe">实缴</span>
                            <span class="cRed">{{platformMoney ? platformMoney : 0}}</span>
                        </p>
                    </div>

                    <div class="analyItemCon" v-else>
                        <p class="col-md-6">
                            <span class="cLightGray pr8">保证金</span>
                            <span>0</span>
                        </p>
                        <p class="col-md-6">
                            <span class="cLightGray pr8">实缴</span>
                            <span>0</span>
                        </p>
                    </div>
                <!-- </div> -->
            </router-link>
    </div>
        <div class=" analyItem">
                <p class="analyItemTit tx-center">处理</p>
                <div class="analyItemCon tx-center">
                </div>
    </div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { findStageInfoById, GetAppUserInfo, getPlatformMoney, selectPmUserInfoManager } from '../Resources/Api'
export default {
    data () {
        return {
            userInfo: {},
            platformMoney: 0,
            Manager: {}, // 入职类型
            stageInfo: {},
            yajin: 0,
            characterArr: [],
            characterList: []
        }
    },
    created () {
        this.GetAppUserInfo()
        this.findStageInfoById()
        this.selectPmUserInfoManager()
        this.getPlatformMoney() // 查询保证金
    },
    computed: {
        ...mapGetters(['leftInfo'])
    },
    methods: {
        // 请求七师的接口
        GetAppUserInfo () {
            GetAppUserInfo({
                post: 4,
                appid: this.leftInfo.rs_app_id
            }).then(result => {
                if (Number(result.data.StatusCode) === 0) {
                    this.userInfo = result.data.Body[0]
                }
            }).catch(err => {
                console.log('请求七师的接口失败，异常信息：' + err)
            })
        },
        // 获取所有信息
        findStageInfoById () {
            findStageInfoById({
                uid: this.leftInfo.uid
            }).then(result => {
                if (Number(result.data.StatusCode) === 0) {
                    this.stageInfo = result.data.Body
                    if (this.stageInfo.character_type !== undefined && this.stageInfo.character_type !== null && this.stageInfo.character_type !== '') {
                        this.characterArr = this.stageInfo.character_type.split(',')
                        this.characterList = []
                        this.characterArr.forEach(character => {
                            let arr = character.split('-')
                            if (Number(arr[0]) === 1) {
                                if (Number(arr[1]) === 1) {
                                    this.characterList.push('开朗')
                                } else {
                                    this.characterList.push('谨慎')
                                }
                            } else if (Number(arr[0]) === 2) {
                                if (Number(arr[1]) === 1) {
                                    this.characterList.push('感性')
                                } else {
                                    this.characterList.push('理性')
                                }
                            } else if (Number(arr[0]) === 3) {
                                if (Number(arr[1]) === 1) {
                                    this.characterList.push('敏感')
                                } else {
                                    this.characterList.push('随和')
                                }
                            } else if (Number(arr[0]) === 4) {
                                if (Number(arr[1]) === 1) {
                                    this.characterList.push('细致')
                                } else {
                                    this.characterList.push('粗糙')
                                }
                            } else if (Number(arr[0]) === 5) {
                                if (Number(arr[1]) === 1) {
                                    this.characterList.push('活泼')
                                } else {
                                    this.characterList.push('稳重')
                                }
                            }
                            // console.log(this.characterList)
                        })
                    }
                }
            }).catch(err => {
                console.log(err)
            })
        },
        // 查询签约
        selectPmUserInfoManager () {
            selectPmUserInfoManager({
                uid: this.leftInfo.uid
            }).then(res => {
                if (res.data.StatusCode === 0) {
                    this.Manager = res.data.Body
                    // this.userJoinState = this.Manager.user_join_state
                }
            }).catch(err => {
                console.log('查询签约 selectPmUserInfoManager失败，原因为' + err)
            })
        },
        // 获取保证金明细表的内容
        getPlatformMoney () {
            this.selectPmUserInfoManager()
            getPlatformMoney({
                uid: this.leftInfo.uid
            }).then(res => {
                if (res.data.StatusCode === 0) {
                    this.pmDeposit = res.data.Body.moneyMaps
                    this.pmDeposit.forEach(item => {
                        if (item.depositState === 1 && item.pmDataSource === 17) {
                            // alert(item.pmDeposit)
                            // 平台费
                            this.platformMoney = item.pmDeposit
                        }
                        if (item.depositState === 1 && item.pmDataSource === 1) {
                            // alert(item.pmDeposit)
                            // 保证金
                            this.yajin = item.pmDeposit
                        }
                    })

                    console.log(this.pmDeposit)
                }
            }).catch(err => {
                console.log('查询平台服务费 getPlatformMoney失败，原因为' + err)
            })
        },
        // 路由跳转路径拼接
        routerPath (path) {
            return this.$route.matched[1].path + '/' + path
        },
        // 直接进行路由跳转路径
        routerPush (path) {
            this.$router.push(this.$route.matched[1].path + '/' + path)
        }
    },
    watch: {
        leftInfo () {
            // if (this.leftInfo !== null && this.leftInfo !== undefined && this.leftInfo !== '') {
            this.findStageInfoById()
            this.GetAppUserInfo()
            // }
        },
        $route () {
            this.findStageInfoById()
        }
    }
}
</script>
